package schema

import (
	"entgo.io/ent"
	"entgo.io/ent/dialect/entsql"
	"entgo.io/ent/schema"
	"entgo.io/ent/schema/field"
	"entgo.io/ent/schema/index"
	"private-domain-overseas-service/pkg/status/bizmall"
	"time"
)

type HzMall struct {
	ent.Schema
}

func (HzMall) Fields() []ent.Field {
	return []ent.Field{
		field.String("mall_icon").NotEmpty().Comment("商城图标"),
		field.String("mall_name").NotEmpty().Comment("商城名称"),
		field.String("mall_url").NotEmpty().Comment("商城地址"),
		field.Int64("mall_status").Default(bizmall.On).Comment("商城图标状态 1.启用 2.禁用"),
		field.Int64("mall_sort").Default(1).Comment("排序，数字越大越靠前"),
		field.Int64("created_at").Immutable().Default(time.Now().Unix()).Comment("创建时间"),
		field.Int64("update_at").Default(time.Now().Unix()).Comment("更新时间"),
		field.Int64("delete_at").Optional().Comment("删除时间"),
	}
}

// Indexes of the Street.
func (HzMall) Indexes() []ent.Index {
	return []ent.Index{
		index.Fields("mall_sort"),
	}
}

func (HzMall) Annotations() []schema.Annotation {
	return []schema.Annotation{
		entsql.WithComments(true),
		schema.Comment("商城表"),
	}
}
